﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<WebSite.Models.RoleModel>" %>
<%@ Import Namespace="WebSite.Models" %>
<%@ Import Namespace="WebSite.App_Code" %>
<%@ Import Namespace="WebSite.App_Data" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Department
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    
    <link href="../../Scripts/jquery-ui/css/redmond/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" />
    <script type="text/javascript" src="../../Scripts/external/jquery.bgiframe-2.1.2.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery-ui-dialog/jquery.ui.core.js"></script>
	<script type="text/javascript" src="../../Scripts/jquery-ui-dialog/jquery.ui.widget.js"></script>
	<script type="text/javascript" src="../../Scripts/jquery-ui-dialog/jquery.ui.position.js"></script>
	<script type="text/javascript" src="../../Scripts/jquery-ui-dialog/jquery.ui.dialog.js"></script>

    <style type="text/css">
        
    .PageList
    {
         background-color:White;
    }
    
    .PageList td
    {
         border-style:outset;
         padding:5px;
         width:100px;
         vertical-align:top;
         cursor:pointer; 
    }
    
    .PageList .EnablePage
    {
        background-color:#5585D5; 
        color:White;
    }
    
    .PageList .DisablePage
    {
        background-color:#EEEEEE; 
        color:Gray;
    }
    
    .OneRole 
    {
        border-left:1px solid black;
        background-color:White;
    }
    
    .OneRole .NameTd
    {
        padding:5px 5px 5px 20px;
        text-align:right;
        border-right:1px solid black;
        border-top:1px solid black;
        background-color:#DDD9C3;
        white-space:nowrap;
    }
    
    .OneRole .ValueTd
    {
        padding:5px;
        border-top:1px solid black;
        border-right:1px solid black;
    }
    
    .OneRole .MidTd
    {
        border-top:1px solid black;
        border-right:1px solid black;
        padding:5px;
    }
    
    .OneRole .BottomTd
    {
        border-top:1px solid black;
        border-bottom:1px solid black;
        border-right:1px solid black;
        padding:5px;
    }
    
    .OneRole .DepartmentTitle
    {
        border:none;
        text-align:center;
        padding:5px;
        border-top:1px solid black;
    }
    
    .OneRole .BlankTd
    {
        border:none;
        text-align:center;
        padding:5px;
    }
    
    .OneRole .TopTd
    {
        border-bottom:1px dashed black;
        border-top:1px solid black;
        padding:5px;
        font-weight:bolder;
        background-color:#C5BE97;
        text-align:center;
    }    
    
    .OneRole .RightTopTd
    {
        border-left:1px dashed black;
        border-top:1px solid black;
        border-right:1px solid black;
    }
    
    .OneRole .HdCeller
    {
        border:none;
        height:30px;
        text-align:center;
        background-color:#DDD9C3; 
        border-left:1px dashed black;
        border-top:1px solid black;
    }
        
    .OneRole .Unable            { background-color:#DDDDDD; color:#777777; border-top:1px dashed black; border-left:1px dashed black; border-right:none; border-bottom:none; text-align:center; cursor:pointer; white-space:nowrap; padding:0px 10px 0px 10px; }
    .OneRole .CanQuery          { background-color:#FCD5B4; border-top:1px dashed black; border-left:1px dashed black; border-right:none; border-bottom:none; text-align:center; cursor:pointer; white-space:nowrap; padding:0px 10px 0px 10px; }
    .OneRole .CanUpload         { background-color:#CCC0DA; border-top:1px dashed black; border-left:1px dashed black; border-right:none; border-bottom:none; text-align:center; cursor:pointer; white-space:nowrap; padding:0px 10px 0px 10px; }
    .OneRole .CanDelete         { background-color:#8064A2; border-top:1px dashed black; border-left:1px dashed black; border-right:none; border-bottom:none; text-align:center; cursor:pointer; white-space:nowrap; padding:0px 10px 0px 10px; }
    .OneRole .CanApprove        { background-color:#B6DDE8; border-top:1px dashed black; border-left:1px dashed black; border-right:none; border-bottom:none; text-align:center; cursor:pointer; white-space:nowrap; padding:0px 10px 0px 10px; }
    .OneRole .CanModify         { background-color:#4BACC6; border-top:1px dashed black; border-left:1px dashed black; border-right:none; border-bottom:none; text-align:center; cursor:pointer; white-space:nowrap; padding:0px 10px 0px 10px; }
    .OneRole .CanAdjust         { background-color:#D7E4BC; border-top:1px dashed black; border-left:1px dashed black; border-right:none; border-bottom:none; text-align:center; cursor:pointer; white-space:nowrap; padding:0px 10px 0px 10px; }
    .OneRole .CanTransfer       { background-color:#92D050; border-top:1px dashed black; border-left:1px dashed black; border-right:none; border-bottom:none; text-align:center; cursor:pointer; white-space:nowrap; padding:0px 10px 0px 10px; }
    .OneRole .CanPaid           { background-color:#E6B9B8; border-top:1px dashed black; border-left:1px dashed black; border-right:none; border-bottom:none; text-align:center; cursor:pointer; white-space:nowrap; padding:0px 10px 0px 10px; }
    .OneRole .CanChangeStatus   { background-color:#F79646; border-top:1px dashed black; border-left:1px dashed black; border-right:none; border-bottom:none; text-align:center; cursor:pointer; white-space:nowrap; padding:0px 10px 0px 10px; }
        
    .OneRole .AddDepartment
    {
         border:none;
         background-color:#FFFFFF;
         font-weight:bolder;
         cursor:pointer;
         font-family:@Arial Black;
         font-size:11pt;
    }
    
    .OneRole .AddCeller
    {
       border:none;
       border-left:1px dashed black;
       border-right:1px solid black;
       width:40px;
       text-align:center;
       cursor:pointer; 
       color:#777777;
       padding:0px 10px 0px 10px;
    }
    
    </style>

    <script type="text/javascript">
    
        $(document).ready(function () {

            if ('<%=ViewData.ContainsKey("DB.Operation.Result") %>' == "True")
                alert('<%=ViewData["DB.Operation.Result"] %>');

        });

        function SetRight(sender, true_css, v) {
            var value = $("input[type=hidden]", $(sender));

            if (value.val().toUpperCase() == "0") {
                $(sender).attr("class", true_css);
                value.val(v);
            }
            else {
                $(sender).attr("class", "Unable");
                value.val("0");
            }   
        }

        function SetSubRole(sender) {

            var Tr = $(sender).parents("tr:eq(0)");
            var Table = $(sender).parents("table:eq(0)");
            
            if ($(sender).val() == "＋") {
                Tr.after("<tr>" + Tr.html() + "</tr>");
                $("td:gt(1):lt(27)", Tr.next()).attr("class", "Unable");
                $(sender).val("－");
                $("input[type=hidden]", Tr.next()).val("0");
            }
            else {
                Tr.remove();
            }
        }

        function OpenPageSet() {
            $(function () {
                $("#dialog-SetPageRight").dialog({
                    height: 340,
                    width: 400,
                    modal: true,
                    parentID: "#DD"
                });
            });
        }

        function SelectPage(sender, Lv, PageID) {

            var me = $(sender)
            var list = $("td[Lv" + Lv + "=" + PageID + "]", $("#PageList"));
            var i_v = $("#IR_PageString");
            var u_v = $("#UR_PageString");

            if ($(sender).attr("select") == "True") {

                me.attr("select", "False");
                me.attr("class", "DisablePage");

                list.attr("select", "False");
                list.attr("class", "DisablePage");

                for (var i = 0; i < list.length; i++) {
                    i_v.val(i_v.val().replace($(list[i]).attr("PageID") + ";", ""));
                    u_v.val(u_v.val().replace($(list[i]).attr("PageID") + ";", ""));
                }

                i_v.val(i_v.val().replace(PageID + ";", ""));
                u_v.val(u_v.val().replace(PageID + ";", ""));

            }
            else {

                me.attr("select", "True");
                me.attr("class", "EnablePage");

                list.attr("select", "True");
                list.attr("class", "EnablePage");

                for (var i = 0; i < list.length; i++) {
                    i_v.val(i_v.val() + $(list[i]).attr("PageID") + ";");
                    u_v.val(u_v.val() + $(list[i]).attr("PageID") + ";");
                }

                i_v.val(i_v.val() + PageID + ";");
                u_v.val(u_v.val() + PageID + ";");
            }
        }

    </script>
    <br />

    <div id="DD"></div>

    <% if (String.IsNullOrEmpty(Model.Update.Role.Guid)) { %> <div> <% } else { %> <div style="display:none"> <% } %>
    
    <% Html.BeginForm("Role_Insert", "MasterData", FormMethod.Post); %>
    <%=Html.Hidden("IR_PageString", Model.PageString) %>
    <table border="0" cellpadding="0" cellspacing="0" class="OneRole">
        <tr>
            <td class="NameTd">角色名</td>
            <td class="ValueTd" colspan="3">
                <%=Html.TextBox("RoleName", "", new { style="width:200px;", @class="budget-txt-no-01" })%>
            </td>
        </tr>
        <tr>
            <td class="NameTd" id="tdRoleMapName" rowspan="1">角色权限设置</td>
            <td colspan="3">
                <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td colspan="1" class="DepartmentTitle">部门</td>
                        <td colspan="1" class="DepartmentTitle">类型</td>
                        <td colspan="4" class="HdCeller">开放提交</td>
                        <td colspan="5" class="HdCeller">已提交</td>
                        <td colspan="4" class="HdCeller">审核中</td>
                        <td colspan="4" class="HdCeller">启用</td>
                        <td colspan="5" class="HdCeller">调整</td>
                        <td colspan="2" class="HdCeller">完成</td>
                        <td colspan="2" class="HdCeller">关闭</td>
                        <td colspan="1" class="HdCeller">历史</td>
                        <td colspan="1" class="RightTopTd">&nbsp;</td>
                    </tr>
                    <% for (int i =0; i < Model.Insert.RoleList.Count; i++ ) { %>
                    <tr>
                        <td class="BlankTd">
                            <%=Html.Hidden("OrderID", Model.Insert.RoleList[i].OrderID)%>
                            <%=Html.DropDownList("Department", Model.Insert.RoleList[i].DepartmentSource)%>
                        </td>
                        <td class="BlankTd">
                            <%=Html.DropDownList("ProjectCtegory", Model.Insert.RoleList[i].ProjectCtegorySource)%>
                        </td>

                        <td class="Unable" onclick="SetRight(this, 'CanQuery', 1)">查询
                            <%=Html.Hidden("OpenAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this, 'CanUpload', 2)">上传
                            <%=Html.Hidden("OpenAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this, 'CanApprove', 4)">审批
                            <%=Html.Hidden("OpenAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this, 'CanChangeStatus', 8)">变更状态
                            <%=Html.Hidden("OpenAuth", "0")%>
                        </td>

                        <td class="Unable" onclick="SetRight(this,'CanQuery', 1)">查询
                            <%=Html.Hidden("UploadAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanUpload', 2)">上传
                            <%=Html.Hidden("UploadAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanDelete', 4)">删除
                            <%=Html.Hidden("UploadAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanApprove', 8)">审批
                            <%=Html.Hidden("UploadAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanChangeStatus', 16)">变更状态
                            <%=Html.Hidden("UploadAuth", "0")%>
                        </td>

                        <td class="Unable" onclick="SetRight(this,'CanQuery',1)">查询
                            <%=Html.Hidden("AuditAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanApprove',2)">审核
                            <%=Html.Hidden("AuditAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanModify',4)">修改
                            <%=Html.Hidden("AuditAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanChangeStatus',8)">变更状态
                            <%=Html.Hidden("AuditAuth", "0")%>
                        </td>

                        <td class="Unable" onclick="SetRight(this,'CanQuery',1)">查询
                            <%=Html.Hidden("InUseAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanAdjust',2)">发起调整
                            <%=Html.Hidden("InUseAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanTransfer',4)">结转
                            <%=Html.Hidden("InUseAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanPaid',8)">发起支付
                            <%=Html.Hidden("InUseAuth", "0")%>
                        </td>

                        <td class="Unable" onclick="SetRight(this,'CanQuery',1)">查询
                            <%=Html.Hidden("AdjustAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanUpload',2)">上传
                            <%=Html.Hidden("AdjustAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanDelete',4)">删除
                            <%=Html.Hidden("AdjustAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanApprove',8)">审批
                            <%=Html.Hidden("AdjustAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanChangeStatus',16)">变更状态
                            <%=Html.Hidden("AdjustAuth", "0")%>
                        </td>

                        <td class="Unable" onclick="SetRight(this,'CanQuery',1)">查询
                            <%=Html.Hidden("CompleteAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanChangeStatus',2)">变更状态
                            <%=Html.Hidden("CompleteAuth", "0")%>
                        </td>

                        <td class="Unable" onclick="SetRight(this,'CanQuery',1)">查询
                            <%=Html.Hidden("CloseAuth", "0")%>
                        </td>
                        <td class="Unable" onclick="SetRight(this,'CanChangeStatus',2)">变更状态
                            <%=Html.Hidden("CloseAuth", "0")%>
                        </td>

                        <td class="Unable" onclick="SetRight(this,'CanQuery',1)">查询
                            <%=Html.Hidden("HistoryAuth", "0")%>
                        </td>

                        <td class="AddCeller">
                            <input type="button" value="＋" class="AddDepartment" onclick="SetSubRole(this)" /></td>
                    </tr>
                    <% } %>
                </table>
            </td>
        </tr>
        <tr>
            <td class="BottomTd" colspan="4">
                <input type="submit" value="新建角色" class="budget-button-no-01" />
            </td>
        </tr>
    </table>
    <% Html.EndForm(); %>
    </div>

    <% if (String.IsNullOrEmpty(Model.Update.Role.Guid)) { %> <div style="display:none"> <% } else { %> <div> <% } %>
    <% Html.BeginForm("Role_Update", "MasterData", FormMethod.Post); %>
    <%=Html.Hidden("UR_PageString", Model.PageString)%>
    <table border="0" cellpadding="0" cellspacing="0" class="OneRole">
        <tr>
            <td class="NameTd">角色名</td>
            <td class="ValueTd" colspan="3">
                <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td>
                            <%=Html.TextBox("RoleName", Model.Update.Role.RoleName, new { style = "width:200px;", @class="budget-txt-no-01" })%>
                            <%=Html.Hidden("ID", Model.Update.Role.Guid) %>                        
                        </td>
                        <td style=" padding-left:10px">
                            <input type="button" class="budget-button-no-01" value="页面访问设置" onclick="OpenPageSet()" />
                            <%=Html.Hidden("RoleDescription", Model.Update.Role.RoleDescription, new { style = "width:500px;" })%>                        
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td class="NameTd" id="td1">角色权限设置</td>
            <td colspan="3">
                <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td colspan="1" class="DepartmentTitle">部门</td>
                        <td colspan="1" class="DepartmentTitle">类型</td>
                        <td colspan="4" class="HdCeller">开放提交</td>
                        <td colspan="5" class="HdCeller">已提交</td>
                        <td colspan="4" class="HdCeller">审核中</td>
                        <td colspan="4" class="HdCeller">启用</td>
                        <td colspan="5" class="HdCeller">调整</td>
                        <td colspan="2" class="HdCeller">完成</td>
                        <td colspan="2" class="HdCeller">关闭</td>
                        <td colspan="1" class="HdCeller">历史</td>
                        <td colspan="1" class="RightTopTd">&nbsp;</td>
                    </tr>
                    <% for (int i = 0; i < Model.Update.RoleList.Count; i++) { %>
                    <tr>
                        <td class="BlankTd">
                            <%=Html.Hidden("OrderID",Model.Update.RoleList[i].OrderID) %>
                            <%=Html.DropDownList("Department", Model.Update.RoleList[i].DepartmentSource) %>
                        </td>
                        <td class="BlankTd">
                            <%=Html.DropDownList("ProjectCtegory", Model.Update.RoleList[i].ProjectCtegorySource)%>
                        </td>

                        <td class="<% if (Model.Update.RoleList[i].OpenAuth.CanQuery) { %>CanQuery<% } else { %>Unable<% } %>" onclick="SetRight(this, 'CanQuery', 1)" >查询
                            <%=Html.Hidden("OpenAuth", Model.Update.RoleList[i].OpenAuth.CanQuery ? "1" : "0")%>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].OpenAuth.CanUpload) { %>CanUpload<% } else { %>Unable<% } %>" onclick="SetRight(this, 'CanUpload', 2)">上传
                            <%=Html.Hidden("OpenAuth", Model.Update.RoleList[i].OpenAuth.CanUpload ? "2" : "0")%>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].OpenAuth.CanApprove) { %>CanApprove<% } else { %>Unable<% } %>" onclick="SetRight(this, 'CanApprove', 4)">审批
                            <%=Html.Hidden("OpenAuth", Model.Update.RoleList[i].OpenAuth.CanApprove ? "4" : "0")%>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].OpenAuth.CanChangeStatus) { %>CanChangeStatus<% } else { %>Unable<% } %>" onclick="SetRight(this, 'CanChangeStatus', 8)">变更状态
                            <%=Html.Hidden("OpenAuth", Model.Update.RoleList[i].OpenAuth.CanChangeStatus ? "8" : "0")%>
                        </td>

                        <td class="<% if (Model.Update.RoleList[i].UploadAuth.CanQuery) { %>CanQuery<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanQuery', 1)">查询
                            <%=Html.Hidden("UploadAuth", Model.Update.RoleList[i].UploadAuth.CanQuery ? "1" : "0")%>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].UploadAuth.CanUpload) { %>CanUpload<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanUpload', 2)">上传
                            <%=Html.Hidden("UploadAuth", Model.Update.RoleList[i].UploadAuth.CanUpload ? "2" : "0")%>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].UploadAuth.CanDelete) { %>CanDelete<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanDelete', 4)">删除
                            <%=Html.Hidden("UploadAuth", Model.Update.RoleList[i].UploadAuth.CanDelete ? "4" : "0")%>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].UploadAuth.CanApprove) { %>CanApprove<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanApprove', 8)">审批
                            <%=Html.Hidden("UploadAuth", Model.Update.RoleList[i].UploadAuth.CanApprove ? "8" : "0")%>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].UploadAuth.CanChangeStatus) { %>CanChangeStatus<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanChangeStatus', 16)">变更状态
                            <%=Html.Hidden("UploadAuth", Model.Update.RoleList[i].UploadAuth.CanChangeStatus ? "16" : "0")%>
                        </td>

                        <td class="<% if (Model.Update.RoleList[i].AuditAuth.CanQuery) { %>CanQuery<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanQuery',1)">查询
                            <%=Html.Hidden("AuditAuth", Model.Update.RoleList[i].AuditAuth.CanQuery ? "1" : "0")%>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].AuditAuth.CanApprove) { %>CanApprove<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanApprove',2)">审核
                            <%=Html.Hidden("AuditAuth", Model.Update.RoleList[i].AuditAuth.CanApprove ? "2" : "0")%>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].AuditAuth.CanModify) { %>CanModify<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanModify',4)">修改
                            <%=Html.Hidden("AuditAuth", Model.Update.RoleList[i].AuditAuth.CanModify ? "4" : "0") %>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].AuditAuth.CanChangeStatus) { %>CanChangeStatus<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanChangeStatus',8)">变更状态
                            <%=Html.Hidden("AuditAuth", Model.Update.RoleList[i].AuditAuth.CanChangeStatus ? "8" : "0") %>
                        </td>

                        <td class="<% if (Model.Update.RoleList[i].InUseAuth.CanQuery) { %>CanQuery<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanQuery',1)">查询
                            <%=Html.Hidden("InUseAuth", Model.Update.RoleList[i].InUseAuth.CanQuery ? "1" : "0") %>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].InUseAuth.CanAdjust) { %>CanAdjust<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanAdjust',2)">发起调整
                            <%=Html.Hidden("InUseAuth", Model.Update.RoleList[i].InUseAuth.CanAdjust ? "2" : "0") %>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].InUseAuth.CanTransfer) { %>CanTransfer<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanTransfer',4)">结转
                            <%=Html.Hidden("InUseAuth", Model.Update.RoleList[i].InUseAuth.CanTransfer ? "4" : "0")%>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].InUseAuth.CanPaid) { %>CanPaid<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanPaid',8)">发起支付
                            <%=Html.Hidden("InUseAuth", Model.Update.RoleList[i].InUseAuth.CanPaid ? "8" : "0") %>
                        </td>

                        <td class="<% if (Model.Update.RoleList[i].AdjustAuth.CanQuery) { %>CanQuery<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanQuery',1)">查询
                            <%=Html.Hidden("AdjustAuth", Model.Update.RoleList[i].AdjustAuth.CanQuery ? "1" : "0") %>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].AdjustAuth.CanUpload) { %>CanUpload<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanUpload',2)">上传
                            <%=Html.Hidden("AdjustAuth", Model.Update.RoleList[i].AdjustAuth.CanUpload ? "2" : "0") %>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].AdjustAuth.CanDelete) { %>CanDelete<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanDelete',4)">删除
                            <%=Html.Hidden("AdjustAuth", Model.Update.RoleList[i].AdjustAuth.CanDelete ? "4" : "0") %>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].AdjustAuth.CanApprove) { %>CanApprove<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanApprove',8)">审批
                            <%=Html.Hidden("AdjustAuth", Model.Update.RoleList[i].AdjustAuth.CanApprove ? "8" : "0") %>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].AdjustAuth.CanChangeStatus) { %>CanChangeStatus<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanChangeStatus',16)">变更状态
                            <%=Html.Hidden("AdjustAuth", Model.Update.RoleList[i].AdjustAuth.CanChangeStatus ? "16" : "0") %>
                        </td>

                        <td class="<% if (Model.Update.RoleList[i].CompleteAuth.CanQuery) { %>CanQuery<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanQuery',1)">查询
                            <%=Html.Hidden("CompleteAuth", Model.Update.RoleList[i].CompleteAuth.CanQuery ? "1" : "0") %>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].CompleteAuth.CanChangeStatus) { %>CanChangeStatus<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanChangeStatus',2)">变更状态
                            <%=Html.Hidden("CompleteAuth", Model.Update.RoleList[i].CompleteAuth.CanChangeStatus ? "2" : "0") %>
                        </td>

                        <td class="<% if (Model.Update.RoleList[i].CloseAuth.CanQuery) { %>CanQuery<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanQuery',1)">查询
                            <%=Html.Hidden("CloseAuth", Model.Update.RoleList[i].CloseAuth.CanQuery ? "1" : "0") %>
                        </td>
                        <td class="<% if (Model.Update.RoleList[i].CloseAuth.CanChangeStatus) { %>CanChangeStatus<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanChangeStatus',2)">变更状态
                            <%=Html.Hidden("CloseAuth", Model.Update.RoleList[i].CloseAuth.CanChangeStatus ? "2" : "0") %>
                        </td>

                        <td class="<% if (Model.Update.RoleList[i].HistoryAuth.CanQuery) { %>CanQuery<% } else { %>Unable<% } %>" onclick="SetRight(this,'CanQuery',1)">查询
                            <%=Html.Hidden("HistoryAuth", Model.Update.RoleList[i].HistoryAuth.CanQuery ? "1" : "0")%>
                        </td>

                        <td class="AddCeller">
                            <input type="button" value="＋" class="AddDepartment" onclick="SetSubRole(this)" /></td>
                    </tr>
                    <% } %>
                </table>
            </td>
        </tr>
        <tr>
            <td class="BottomTd" colspan="4">
                <input type="submit" value="修改角色" />
            </td>
        </tr>
    </table>
    <% Html.EndForm(); %>
    </div>
    <br />

    <table border="0" cellpadding="0" cellspacing="1" class="masterdatatable">
        <tr class="masterdatatable_header">
            <td>角色名</td>
            <td>角色描述</td>
            <td></td>
        </tr>
            
    <% for (int i = 0; i < Model.Table.Count; i++) { %>
        <% if ((i % 2) == 1) { %> 
            <tr class="masterdatatable_odd" RowType="Display"> 
        <% } else { %> 
            <tr class="masterdatatable_even" RowType="Display">  
        <% } %>
            <td>
                <%=Model.Table[i].Role.RoleName%>
            </td>
            <td><%=Model.Table[i].Role.RoleDescription%></td>
            <td>
                <%=Html.ActionLink("修改", "Role_Edit", new { ID = Model.Table[i].Role.Guid }) %>
                <%=Html.ActionLink("删除", "Role_Delete", new { ID = Model.Table[i].Role.Guid })%>
            </td>
        </tr>        
    <% } %>
    </table>

    <div id="dialog-SetPageRight" title="页面访问设置" style=" display:none; padding:20px">
        <center>
            <table border="0" cellpadding="0" cellspacing="1" class="PageList" id="PageList">
            <% foreach (md_Page P in Model.AllPage) { %>
                <% if (P.Lv == 1) { %>
                    <tr>
                        <td rowspan="<%=Model.AllPage.Count(o=>o.Lv == 3 && o.Lv1 == P.PageID) %>"
                            <%if (Model.PageString.Contains(P.PageID)) { %> class="EnablePage" <% } %>
                            <% else { %> class="DisablePage" <% } %>
                             Lv1="<%=P.Lv1 %>" Lv2="<%=P.Lv2 %>" Select="<%=Model.PageString.Contains(P.PageID) %>" PageID ="<%=P.PageID %>"
                             onclick="SelectPage(this,'<%=P.Lv %>', '<%=P.PageID %>')" 
                            ><%=P.PageTitle %></td>
                <% } %>
                <% if (P.Lv == 2) { %>                    
                    <td rowspan="<%=Model.AllPage.Count(o=>o.Lv == 3 && o.Lv2 == P.PageID) %>"
                        <%if (Model.PageString.Contains(P.PageID)) { %> class="EnablePage" <% } %>
                        <% else { %> class="DisablePage" <% } %>
                         Lv1="<%=P.Lv1 %>" Lv2="<%=P.Lv2 %>" Select="<%=Model.PageString.Contains(P.PageID) %>" PageID ="<%=P.PageID %>"
                         onclick="SelectPage(this,'<%=P.Lv %>', '<%=P.PageID %>')" 
                        ><%=P.PageTitle %></td>
                <% } %>
                <% if (P.Lv == 3) { %>
                    <% if (P.PageID.Substring(4, 2) != "01"){ %><tr><% } %>
                    <td <%if (Model.PageString.Contains(P.PageID)) { %> class="EnablePage" <% } %>
                        <% else { %> class="DisablePage" <% } %>
                         Lv1="<%=P.Lv1 %>" Lv2="<%=P.Lv2 %>" Select="<%=Model.PageString.Contains(P.PageID) %>" PageID ="<%=P.PageID %>"
                         onclick="SelectPage(this,'<%=P.Lv %>', '<%=P.PageID %>')" 
                        ><%=P.PageTitle %></td>
                    </tr>
                <% } %>
            <% } %>
            </table>
        </center>
    </div>
</asp:Content>
